package com.basic.bio.easy;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @Description:
 * @Date: 2024-03-28 11:07
 * @Author: wz
 **/
public class Server {

    public static void main(String[] args){
        try {
            ServerSocket ss = new ServerSocket(9090);
            Socket socket = ss.accept();
            InputStream is = socket.getInputStream();

//            BufferedReader br = new BufferedReader(new InputStreamReader(is));
//            String msg;
//            while ((msg = br.readLine()) != null){
//                System.out.print(msg);
//            }


            int len;
            byte[] buf = new byte[10];
            while ((len = is.read(buf)) != -1){
                System.out.print(new String(buf,0,len));
            }
//            is.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
